package bookstudytest.lambda;

import java.util.*;

/**
 * @Auther: Lee
 * @Date: 2018/6/6 19:35
 * @Description:
 */
public class LambdaDemo {
    public void oldCompare(){
        List<String> ls = Arrays.asList("name","dage","xiaodi","wudi");
        Collections.sort(ls, new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return o1.compareTo(o2);
            }
        });
        ls.forEach(System.out::println);
    }

    public void lambdaCompare(){
        List<String> ls = Arrays.asList("name","dage","xiaodi","wudi");
        Collections.sort(ls, Comparator.naturalOrder());
        ls.forEach(System.out::println);
    }

    public static void main(String[] args) {
        Person person = new Person();
        LifeAction<String, String> eat = person::eat;
        System.out.println(eat.requiredAction("noodle"));
    }
}
